package com.ruoqing.admin.controller;

import com.baomidou.mybatisplus.extension.api.R;
import com.ruoqing.admin.api.LogHandleService;
import com.ruoqing.core.dto.log.LogPageDto;
import com.ruoqing.core.vo.log.LogResponseVo;
import com.ruoqing.core.web.BaseRestApi;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
	* @author YaoXian
	* @title: LogRestApi
	* @projectName ruoxi-blog
	* @description: 若兮微服务 - 后台管理中心 - 日志控制层
	* @date 2020-12-08 21:57
	*/

@RestController
@RequestMapping(path = "/log")
@Api(tags = "后台管理中心对外HTTP调用 - 管理员操作日志Rest接口")
public class LogRestApi extends BaseRestApi {
		
		@Resource
		private LogHandleService logHandleService;
		
		@ApiOperation(value = "日志查询", httpMethod = "GET")
		@GetMapping(path = {"/page/{pageSize}","/"})
		public R<LogPageDto> showLogPage(Integer currentPage,@PathVariable Integer pageSize){
				return R.ok(logHandleService.selectLogByPage(currentPage,pageSize));
		}
		
		@ApiOperation(value = "日志删除", httpMethod = "DELETE")
		@DeleteMapping(path = "/delete")
		public LogResponseVo deleteLog(Integer logId){
				return logHandleService.deleteBaseLog(logId);
		}
}
